
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[spPlate_GetAllPlates]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[spPlate_GetAllPlates]
GO

GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Eric Liew
-- Create date: 6/2/2009
-- Description:	Get all Plate
-- =============================================
CREATE PROCEDURE [dbo].[spPlate_GetAllPlates]
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;


	SELECT 
		PlateId,
		PlateNumber,
		Plate.OwnerId,
		Plate.PlateTypeId,
		PlateType.PlateDescription,
		Owner.FirstName + ' ' + Owner.LastName AS OwnerName
	FROM Plate
	LEFT JOIN Owner
	ON Owner.OwnerId = Plate.OwnerId
	LEFT JOIN PlateType
	ON PlateType.PlateTypeId = Plate.PlateTypeId
 

END
GO
